package com.tjcu.service.impl;

import com.tjcu.dao.MarkDao;
import com.tjcu.entity.Mark;
import com.tjcu.service.MarkService;
import com.tjcu.utils.MybatisUtil;

import java.util.List;

/**
 * @author 王恒杰
 * @version 1.0
 * @date 2021/11/1 15:08
 * @email 1078993387@qq.com
 * @Address 天津
 * @Description:
 */
public class MarkServiceImpl implements MarkService {
    @Override
    public void insertMark(Mark mark) {
        MarkDao mapper = (MarkDao) MybatisUtil.getMapper(MarkDao.class);
        mapper.insertMark(mark);
        MybatisUtil.commit();
    }

    @Override
    public void deleteMark(Integer id) {
        MarkDao mapper = (MarkDao) MybatisUtil.getMapper(MarkDao.class);
        mapper.deleteMark(id);
        MybatisUtil.commit();
    }

    @Override
    public List<Mark> selectMark() {
        MarkDao mapper = (MarkDao) MybatisUtil.getMapper(MarkDao.class);
        List<Mark> marks = mapper.selectMark();
        MybatisUtil.close();
        return marks;
    }
}
